package org.jks.service;

import java.util.List;

import org.jks.model.Privilege;
import org.springframework.stereotype.Service;

@Service
public class PrivilegeService extends EntityService<Privilege>{
	
	public PrivilegeService(){
		MODEL_NAME = Privilege.class.getSimpleName();
		CLASS_NAME = Privilege.class;
	}
	
	public List<Privilege> findPrivilegesByIds(long[] ids)
	{
		StringBuilder strIds = new StringBuilder();
		strIds.append('(');
		int imax = ids.length - 1;
		for (int i = 0;; i++) {
			strIds.append(ids[i]);
			if (i == imax) {
				strIds.append(')');
				break;
			}
			strIds.append(", ");
		}
		String hql = "from " + MODEL_NAME + " where id in " + strIds;
		List<Privilege> temp = super.find(hql);
		
		return temp;
	}
}
